package 链表;

public class _328奇偶链表 {
    public ListNode oddEvenList(ListNode head) {
        if(head == null){
            return null;
        }
        ListNode even_head = head.next;
        ListNode odd = head,even = even_head;
        while (even != null && even.next != null){
            odd.next = even.next;
            odd = odd.next;

            even.next = odd.next;
            even = even.next;
        }
        odd.next = even_head;
        return head;
    }
}
